package newsDB;

import java.util.List;

import newsEntity.Topic;

public class TopicDao extends BaseDao {
	public static final TopicDao td = new TopicDao();

	public List<Topic> findTopic() {
		String sql = "select * from topic group by `tid`";
		return find(sql, Topic.class);
	}

	public int addTopic(String tname) {
		String sql = "INSERT INTO `topic`(tname) VALUES(?)";
		return executeUpdate(sql, tname);
	}

	public int changeTopic(Long tid, String tname) {
		String sql = "UPDATE `topic` SET `tname`=? WHERE tid=?";
		return executeUpdate(sql, tname, tid);
	}
}
